package com.itheima.springboot.controller;

import com.itheima.springboot.pojo.User;
import com.itheima.springboot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.sql.DataSource;

/**
 * @author 何景航
 * @date 2024/12/16
 */
@RestController
public class HelloController {
    @Autowired
    private DataSource dataSource;
    @Value("${itcast.url}")
    private String itcastUrl;
    @Value("${itheima.url}")
    private String itheimaUrl;
    @Autowired
    private UserService userService;
    @GetMapping("/user/{id}")
    public User queryById(@PathVariable Long id){
        return userService.queryById(id);
    }
    @GetMapping("hello")
    public String hello(){
        System.out.println(itcastUrl);
        System.out.println(itheimaUrl);
        System.out.println(dataSource);
        return "hello spring boot";
    }
}
